package com.hnkywl.sts.entity.jhgl;

import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.htgl.Ht;
import com.hnkywl.sts.entity.organ.Nbbm;
import com.hnkywl.sts.entity.organ.Nbgs;
import org.hibernate.annotations.Formula;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * 统配物资物资计划
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-4-2
 * Time: 上午9:34
 * To change this template use File | Settings | File Templates.
 */
@Entity
@DiscriminatorValue("Tpwzjh")
public class Tpwzjh extends Cgwzjh {
    // 统筹部门
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TCBM_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbbm tcbm;

    // 统筹公司
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TCGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbgs tcgs;

    //统筹方式
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SJZDZ_TCFS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz tcfs;

    // 计划明细
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Tpwzjhmx.class, mappedBy = "tpwzjh")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Tpwzjhmx> tpwzjhmxList;

    // 资金计划
    @OneToOne(fetch = FetchType.LAZY, targetEntity = Tpzjjh.class, mappedBy = "tpwzjh")
    @NotFound(action = NotFoundAction.IGNORE)
    private Tpzjjh tpzjjh;


    @Formula(" (select sum(t.HDSL) from T_BIZ_TPWZJHMX t where t.TPWZJH_ID=ID) ")
    private Double tphdsl;

    public Nbbm getTcbm() {
        return tcbm;
    }

    public void setTcbm(Nbbm tcbm) {
        this.tcbm = tcbm;
    }

    public Nbgs getTcgs() {
        return tcgs;
    }

    public void setTcgs(Nbgs tcgs) {
        this.tcgs = tcgs;
    }

    public Sjzdz getTcfs() {
        return tcfs;
    }

    public void setTcfs(Sjzdz tcfs) {
        this.tcfs = tcfs;
    }

    public List<Tpwzjhmx> getTpwzjhmxList() {
        return tpwzjhmxList;
    }

    public void setTpwzjhmxList(List<Tpwzjhmx> tpwzjhmxList) {
        this.tpwzjhmxList = tpwzjhmxList;
    }

    public Tpzjjh getTpzjjh() {
        return tpzjjh;
    }

    public void setTpzjjh(Tpzjjh tpzjjh) {
        this.tpzjjh = tpzjjh;
    }

    public Double getTphdsl() {
        return tphdsl;
    }

    public void setTphdsl(Double tphdsl) {
        this.tphdsl = tphdsl;
    }
}
